<?php

use console\services\MigrateService;
use yii\db\Migration;

/**
 * Handles the creation of table `sys_login_log`.
 */
class m231229_144109_create_sys_login_log_table extends Migration
{
    /**
     * {@inheritdoc}
     */
    public function safeUp()
    {
        $this->createTable('sys_login_log', [
            'id' => $this->bigPrimaryKey(),
            'login_name' => $this->string(64)->defaultValue('')->null()->comment('登录账号'),
            'user_type' => $this->string(64)->defaultValue('')->null()->comment('账户类型'),
            'platform' => $this->string(32)->defaultValue('')->null()->comment('平台'),
            'ipaddr' => $this->string(64)->defaultValue('')->null()->comment('登录ip'),
            'location' => $this->string(255)->defaultValue('')->null()->comment('登录地点'),
            'browser' => $this->string(128)->defaultValue('')->null()->comment('浏览器类型'),
            'os' => $this->string(128)->defaultValue('')->null()->comment('操作系统'),
            'net' => $this->string(64)->defaultValue('')->null()->comment('登录账号'),
            'status' => $this->char(1)->defaultValue('0')->null()->comment('登录状态'),
            'msg' => $this->string(128)->defaultValue('')->null()->comment('提示消息'),
            'create_time' => $this->bigInteger()->defaultValue(0)->null()->comment('创建时间')
        ], MigrateService::createTableOptions('登录日志表'));
    }

    /**
     * {@inheritdoc}
     */
    public function safeDown()
    {
        $this->dropTable('sys_login_log');
    }
}
